<template>
  <div class="tuijian">
    <h2 class="hometitle">推荐文章</h2>
    <ul class="tjpic">
      <i>
        <img
          style="cursor:pointer"
          :src="RecArticle[0].photoList[0]"
          @click="to(RecArticle[0].uid)"
        />
      </i>
      <p>
        <a href="javascript:void(0);">{{RecArticle[0].title}}</a>
      </p>
    </ul>

    <ul class="sidenews">
      <li v-for="item in RecArticle.slice(1,RecArticle.length)" :key="item.uid" @click="to(item.uid)">
        <i>
          <img
            style="cursor:pointer"
            :src="item.photoList[0]"
          />
        </i>
        <p>
          <a href="javascript:void(0);">{{item.title}}</a>
        </p>
        <span>{{item.createTime}}</span>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      RecArticle: [
      ]
    };
  },
  created(){
    let session=window.localStorage
    let blogs=JSON.parse(session.getItem("blogs"))
    this.RecArticle.push(blogs[5])
    this.RecArticle.push(blogs[7])
  },
  methods: {
    to(blogUid) {
      let routeData = this.$router.resolve({
        path: "/info",
        query: { blogUid }
      });
      window.open(routeData.href, "_blank");
    }
  }
};
</script>

<style>
</style>